<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglib.jsp" %>
<HTML>
<x:multiLanguage>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href='<s:url value="/core/form/webeditor/editor/css/dialog.css"/>' rel="stylesheet" type="text/css" />
<link href='<s:url value="/core/form/webeditor/editor/css/ddtabmenu_dialog.css"/>' rel="stylesheet" type="text/css" />

<script src='<s:url value="/core/form/webeditor/\editor/dialog/common/fck_dialog_common.js"/>' type="text/javascript"></script>
<script language="JavaScript" src='<s:url value="/core/form/webeditor/editor/js/dialog.js"/>'></script>
<script language="JavaScript" src='<s:url value="/core/form/webeditor/editor/js/script.js"/>'></script>
<script language="JavaScript" src='<s:url value="/core/form/webeditor/editor/js/sequence.js"/>'></script>
<script language="JavaScript" src='<s:url value="/script/jquery/jquery-1.4.2.js" />'></script>
<script language="JavaScript" src='<s:url value="/script/ddtabmenufiles/ddtabmenu.js" />'></script>

<SCRIPT language="JavaScript">
var dialog	= window.parent ;
var oEditor = dialog.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
var oActiveEl = dialog.Selection.GetSelectedElement() ;
function Ok() {
	if(ev_check()){
		oEditor.FCKUndo.SaveUndoStep() ;
		//var id=getFieldId();
		createRelStr(); // 保存值到processDescription
		var json = getFormJSON(); // 查看dialog.js
		json['className'] = "cn.myapps.core.dynaform.form.ejb.DateField";
		oActiveEl = CreateNamedElement(oEditor, oActiveEl, 'INPUT', json);		
		return true;
	}
}
//检查内容是否完成正确
function ev_check(){
   if(temp.name.value==''){
 	 alert("{*[page.name.notexist]*}");
	  return false;
   }
   return !checkStartChar(temp.name.value);
}

function checkStartChar(value){
	return IsDigit(value,"{*[page.name.startingit]*}");
}

function ev_onTextTypeChanged(value){
	//文本类型如果为只读是,显示“只显示文本”选项组
	if(value == 'readonly'){
		$('#nbr').show();
	} else {
		$('#nbr').hidden();
	}
	//文本类型如果为隐藏时,则隐藏脚本选项卡无效，不可操作
	if(value == 'hidden'){
		$('#hiddenValue').val("");
		$('#hiddenScript').attr("disabled", "disabled");
		$('#hiddenScriptEditor').disabled = "disabled";
		$('#hiddenValue').disabled = "disabled";
	} else {
		$('#hiddenScript').disabled = "";
		$('#hiddenScriptEditor').disabled = "";
		$('#hiddenValue').disabled = "";
	}
}
function ev_onTyepch() {
	$('#npTD').hide();
	$('#noneTD').hide();
	$('#npDiv').hide();
    if (document.getElementsByName('fieldType').value == 'VALUE_TYPE_NUMBER'){
    	$('#npTD').show();
    	$('#npDiv').show();
 	} else {
 		$('#noneTD').show();
 	}
}

$(function() {
	//初始值
	oEditor.FCKLanguageManager.TranslatePage(document) ;
	if ( oActiveEl && (oActiveEl.tagName == 'DATE')) {
		setFormByObject(oActiveEl); // 查看dialog.js
		var items = HTMLDencode(oActiveEl.processDescription);
	    parseRelStr(items);
	}

	ddtabmenu.definemenu("tabs", "t1");
	ev_onTyepch();
	//initForm();
	modeChange($("input[name=editMode]:checked").val());
	SelectField( 'name' ); // 选中字段
	dialog.SetOkButton( true ) ;
	dialog.SetAutoSize( true ) ;
});
</script>

</HEAD>

<BODY>

	<form name="temp">
			<div id="tabs" class="basictab">
				<ul>
				<li><a id="t1" rel="tabs-1">{*[Basic]*}</a></li>
				<li><a id="t2" rel="tabs-2">{*[Value_Script]*}</a></li>
				<li><a id="t3" rel="tabs-3">{*[Validate_Script]*}</a></li>
				<li><a id="t4" rel="tabs-4">{*[Hidden_Script]*}</a></li>
				<li><a id="t5" rel="tabs-5">{*[Hidden_Print_Script]*}</a></li>
				<li><a id="t6" rel="tabs-6">{*[ReadOnly_Script]*}</a></li>
				</ul>
			</div>	
		<div id="contents">	
			<div id="tabs-1">
			<!-- content1 -->
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content1" width="100%">
					<tr>
						<td class="commFont commLabel">{*[Name]*}:</td>
						<td colspan="2"><input type=text name="name" size="20" onchange="checkStartChar(this.value);"></td>
						<td class="commFont commLabel">{*[TextType]*}:</td>
						<td><select name="textType">
							<option value="text" selected>{*[Common]*}</option>
							<option value="readonly">{*[Readonly]*}</option>
							<option value="hidden">{*[Hidden]*}</option>
						</select></td>
					</tr>
					<tr>
						<td class="commFont commLabel">{*[Format]*}:</td>
						<td colspan="4"><select name="datePattern" onchange="ev_datePattern_change(this.value)">
							<option value="YMD">{*[yyyy-MM-dd]*}</option>
							<option value="YMD_HM">{*[yyyy-MM-dd %h:%m]*}</option>
							<option value="YMD_HMS">{*[yyyy-MM-dd %h:%m:%s]*}</option>
							<option value="HMS">{*[%h:%m:%s]*}</option>

						</select></td>


					</tr>
					<tr id="tr_limit">
						<td class="commFont commLabel">{*[Limit]*}:</td>
						<td colspan="4"><input type="checkbox"
							name="limit" value="true" onClick="ev_onLimit()" /> <span
							id="isDisplayPrev">{*[Prev_Name]*}<input type="text"
							name="prev_Name" value="" /></span></td>
					</tr>

					<tr>
						<td align="center" colspan="5">
						<input type=checkbox name="refreshOnChanged" value="true" checked>{*[Refresh]*}&nbsp;
						<input type=checkbox name="calculateOnRefresh" value="true">{*[Recalculate]*}&nbsp;
						</td>
					</tr>
					<tr>
						<td class="commFont commLabel">{*[Description]*}:</td>
						<td colspan="4"><textarea name="discript" style="width:100%" rows="4"></textarea></td>
					</tr>
				</table>
				</div>
				<div id="tabs-2">
					<table border=1 cellpadding=3 cellspacing=1 class="content"
						id="content2">
						<tr>
							<%@include file="../../dialog/commondialog.jsp"%>
						</tr>
					</table>
				</div>
				<div id="tabs-3">
					<table border=1 cellpadding=3 cellspacing=1 class="content"
						id="content3">
						<tr>
							<td width="25%">
							<table>
							</table>
							</td>
							<td width="75%"><textarea name="validateRule" style="width:95%"
								rows="10"></textarea>
								</td>
						</tr>
					</table>
				</div>
				<div id="tabs-4">
					<table border=1 cellpadding=3 cellspacing=1 class="content"
						id="content4">
						<tr>
							<td><textarea name="hiddenScript" style="width:96%" rows="10"></textarea>
							</td>
						</tr>
						<tr>
							<td>{*[hiddenValue]*}：<input id="hiddenValue" type="text" name="hiddenValue" /></td>
						</tr>
					</table>
					</div>
				<div id="tabs-5">
					<table border=1 cellpadding=3 cellspacing=1 class="content"
						id="content5">
						<tr>
							<td><textarea name="hiddenPrintScript" style="width:96%" rows="10"></textarea>
							</td>
						</tr>
						<tr>
							<td>{*[Print]*}{*[hiddenValue]*}：<input  type="text" name="printHiddenValue" /></td>
						</tr>
					</table>
				</div>
				<div id="tabs-6">
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content6">
					<tr>
						<td><textarea name="readonlyScript" style="width:96%" rows="10"></textarea>
						</td>
					</tr>
				</table>
				</div>
</form>
</BODY>
</x:multiLanguage>
</HTML>
